class Solution:

def firstUniqChar\(self, s\):

    """

    :type s: str

    :rtype: int

    """

    result=0

    while result<len\(s\):

        if result >0 and s\[result\] not in s\[result+1:\] and s\[result\] not in s\[0:result\]:

            return result

        elif result == 0 and s\[result\] not in s\[result+1:\]: 

            return result

        else:

            result+=1

    return -1

这个测试点可多了可多了。。。。

我发现这个最主要的问题是什么呢,就是str[a:b]实际上是a到b-1

results matching ""

    No results matching ""